// 一边压缩，Gzip压缩 解压缩
const { createReadStream, createWriteStream } = require('fs');
const { pipeline } = require('stream');
const {createGzip}=require('zlib');

const gzip=new createGzip();
const source=createReadStream('index.html');
const destination = createWriteStream('index.html.gz');

// source 压缩
pipeline(source,gzip,destination,(err)=>{  // 管道
    if(err){
        console.error(err);
    }
})
